home *** CD-ROM | disk | FTP | other *** search
/ NetNews Offline 2 / NetNews Offline Volume 2.iso / news / comp / lang / c-part1 / 8863 < prev    next >
Encoding:
Internet Message Format  |  1996-08-05  |  1.8 KB

  1. Path: ix.netcom.com!news
  2. From: a1s@ix.netcom.com (Andrew Snyder)
  3. Newsgroups: comp.lang.c
  4. Subject: Re: Object Oriented programming in C ????
  5. Date: Wed, 06 Mar 1996 22:18:27 GMT
  6. Organization: Netcom
  7. Message-ID: <4hkor1$3pu@dfw-ixnews1.ix.netcom.com>
  8. References: <4higq7$5j2@sidhe.memra.com>
  9. NNTP-Posting-Host: har-ct1-22.ix.netcom.com
  10. X-NETCOM-Date: Wed Mar 06  1:25:21 PM CST 1996
  11. X-Newsreader: Forte Free Agent 1.0.82
  12.  
  13. michael@memra.com (Michael Dillon) wrote:
  14.  
  15. >Does anyone know of resources that explain how to write OO programs in C?
  16. >I know about C++ and Objective C and I don't like either one. I would 
  17. >like to be able to write OO programs in straight C (with some 
  18. >preprocessor help for syntactic sugar) so that my code is fully portable 
  19. >between a number os OS's.
  20.  
  21. >-- 
  22. >Michael Dillon                                    Voice: +1-604-546-8022
  23. >Memra Software Inc.                                 Fax: +1-604-546-3049
  24. >http://www.memra.com                             E-mail: michael@memra.com
  25.  
  26. There is no magic to OO design that requires a particular language,
  27. all you need to do is hide the implementation of your "objects" behind
  28. a set of function calls.  The file handling provided by "stdio.h" is a
  29. good example:
  30.  
  31. 1) All possible operations on files map to a paticular function call.
  32. 2) The detail of files are "hidden" from the user-programmer.
  33. 3) Files can be different things on different systems (i.e. disk file,
  34. pipe, tape drive)
  35.  
  36. What an OO language will get you is better support for things like
  37. initialization, real information hiding, type checking, etc.
  38.  
  39. Just build a function library and hide as much stuff as you can with
  40. static variables.  Be sure to include the libraries header file in
  41. every c file to catch errs.
  42. Andrew Snyder
  43. a1s@ix.netcom.com
  44. char disclaimer[] = {'\0'}; /* I'm on cash net */
  45.  
  46.